package leetcode.shuangpoint;

/**
 两数之和 II - 输入有序数组
 */
public class TwoSum {

    public static void main(String[] args) {


    }
    public int[] twoSum(int[] numbers, int target) {
            int i =0,j = numbers.length-1;

            while (i<j){
                if(numbers[i] + numbers[j] == target)
                    break;

                if(numbers[i] + numbers[j] < target)
                    i++;
                else
                    j--;

            }
        return new int[]{i+1,j+1};
    }
}